<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>company</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
  <link rel="stylesheet" href="../css/public.css" media="all">
</head>

<body>
  <div class="layuimini-container">
    <div class="layuimini-main">
      <form class="layui-form" action="">
        <div class="layui-row">
          <div class="layui-col-md3">
            <div class="layui-form-item">
              <label class="layui-form-label">申报编号：</label>
              <div class="layui-input-block">
                <input type="text" name="declare_num" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
              </div>
            </div>
          </div>
          <div class="layui-col-md6">
            <div class="layui-form-item">
              <label class="layui-form-label">申报时间：</label>
              <div class="layui-input-inline">
                <input type="text" name="declaration_time" id="date" placeholder="请选择日期" autocomplete="off" class="layui-input">
              </div>
            </div>
          </div>
        </div>
        <div class="layui-row">
          <div class="layui-col-md3">
            <div class="layui-form-item">
              <div class="layui-input-block">
                <button class="layui-btn" type="button" lay-submit lay-filter="search">查询</button>
                <button class="layui-btn layui-btn-primary" lay-submit lay-filter="reset">重置</button>
              </div>
            </div>
          </div>
        </div>
      </form>
      <table class="layui-hide" id="CompanyTableId" lay-filter="currentTableFilter"></table>
      <script type="text/html" id="currentTableBar">
        <a class="layui-btn layui-btn-xs layui-btn-danger data-count-handle" lay-event="handle">查看</a>
      </script>
    </div>
  </div>
  <script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
  <script src="../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
  <script src="../js/lay-config.js?v=1.0.4" charset="utf-8"></script>
  <script src="../js/ManualPaging.js"></script>
  <script>
    if (!localStorage.getItem("userName")) {
      window.location = './login-1.html';
    }
    layui.use(['form', 'table', 'laydate', 'miniTab'], function() {
      var $ = layui.jquery,
        form = layui.form,
        table = layui.table,
        laydate = layui.laydate,
        miniTab = layui.miniTab

      laydate.render({
        elem: '#date' //指定元素
      });

      // 表格
      table.render({
        elem: '#CompanyTableId',
        url: '' + publicurl + 'pro/getDeclare',
        request: {
          pageName: 'pageNum', //页码的参数名称，默认：page
          limitName: 'pageSize' //每页数据量的参数名，默认：limit
        },
        parseData: function(res) { //res 即为原始返回的数据
          console.log(res)
          return {
            "code": res.status, //解析接口状态,默认成功是0
            "msg": res.msg, //解析提示文本
            "count": res.obj.total, //解析数据长度
            "data": res.obj.list //解析数据列表
          };
        },
        cols: [
          [
            { field: 'declare_num', width: '20%', title: '申报编号', align: "center" },
            { field: 'declare_title', width: '20%', title: '申报标题', align: "center" },
            { field: 'nodeName', width: '10%', title: '环节状态', align: "center" },
            { field: 'finishStatus', width: '10%', title: '任务状态', align: "center" },
            { field: 'declaration_time', width: '20%', title: '申报时间', align: "center" },
            { title: '操作', width: '20%', toolbar: '#currentTableBar', align: "center" },

          ]
        ],
        limits: [10, 15, 20, 25, 50, 100],
        limit: 10,
        id: 'tabel',
        page: true,
        skin: 'line',
        done: function(res, curr, count) {

        }

      });

      /**
       * toolbar监听事件
       */
      table.on('tool(currentTableFilter)', function(obj) {
        if (obj.event === 'handle') { // 监听查看操作
          // 打开新的窗口
          console.log('++++link_status++++++')
          console.log(obj.data.link_status)
          console.log(obj.data.nodeName)
          console.log(obj.data.PROC_INST_ID_)
          console.log('+++link_status+++++++')
          console.log(obj)
          miniTab.openNewTabByIframe({
            href: "page/step" + obj.data.link_status + ".html?id=" + obj.data.PROC_INST_ID_ + "&name=" + obj.data.nodeName + '&type=2',
            title: '申报详情',
          });
        }
      });

      form.on('submit(search)', function(data) {
        table.reload('tabel', {
          url: '' + publicurl + 'pro/getDeclare',
          page: { curr: 1 },
          where: data.field // 查询条件
        }, 'data')
      });
      form.on('submit(reset)', function(data) {
        table.reload('tabel', {
          url: '' + publicurl + 'pro/getDeclare',
          page: { curr: 1 }
        }, 'data')
      });
    });
  </script>

</body>

</html>